package org.jeecg.modules.inspect.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.inspect.entity.InsClassesSpecialDate;
import org.jeecg.modules.inspect.mapper.InsClassesSpecialDateMapper;
import org.jeecg.modules.inspect.mapper.InsClassesSpecialDateSubMapper;
import org.jeecg.modules.inspect.service.IInsClassesSpecialDateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;

/**
 * @Description: 特殊日期配置
 * @Author: jeecg-boot
 * @Date:   2024-03-10
 * @Version: V1.0
 */
@Service
public class InsClassesSpecialDateServiceImpl extends ServiceImpl<InsClassesSpecialDateMapper, InsClassesSpecialDate> implements IInsClassesSpecialDateService {

	@Autowired
	private InsClassesSpecialDateMapper insClassesSpecialDateMapper;
	@Autowired
	private InsClassesSpecialDateSubMapper insClassesSpecialDateSubMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		insClassesSpecialDateSubMapper.deleteByMainId(id);
		insClassesSpecialDateMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			insClassesSpecialDateSubMapper.deleteByMainId(id.toString());
			insClassesSpecialDateMapper.deleteById(id);
		}
	}
	
}
